package com.systop.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.systop.dao.mapper.ExpandBaseMapper;
import com.systop.domain.to.QueryStockTo;
import com.systop.entity.GoodsStock;
import com.systop.utils.sql.PageUtils;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @Description: TODO
 * @Author: jsj
 * @Date: 2023/2/19
 */

public interface GoodsStockDao extends ExpandBaseMapper<GoodsStock> {

    List<Long> existGoodsIds(@Param("goodsIds") List<Long> goodsIds);

    Integer updateBatchByGoodsId(@Param("goodsStockList") List<GoodsStock> goodsStockList);

    GoodsStock getStockByGoodsId(@Param("goodsId") Long goodsId);

    List<QueryStockTo> queryStockList(
            IPage<QueryStockTo> page,
            @Param("greaterStockNum") Integer greaterStockNum, @Param("lessStockNum") Integer lessStockNum);

    Long lockStock(@Param("goodsId") Long goodsId, @Param("goodsNum") Integer goodsNum);
}
